import java.net.InetAddress;
import java.net.UnknownHostException;

public class IPtest {
    //类  InetAddress
    /* *
     * 1.类  InetAddress
     *      没有提供构造方法，使用静态方法 getByName() 获取对象
     * 2.子类 Inet4Address
     * 3.子类 Inet6Address
     */

    public static void main(String[] args) throws UnknownHostException {
        InetAddress inetAddress = InetAddress.getByName("127.0.0.1");
        System.out.println(inetAddress.getHostAddress());
        System.out.println(inetAddress.getHostName());
    }
}
